<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core-rt" prefix="c-rt" %>
<%@ taglib uri="http://java.jeffheaton.com/taglib/jstl/forum" prefix="forum" %>

<forum:expire>
  <c:redirect url="index.jsp" />
</forum:expire>

<c:if test="${user.id=='G'}">
  <c:redirect url="main.jsp" />
</c:if>

<c:if test="${pageContext.request.method=='POST'}">
  <c:if test="${param.cancel!=null}">
    <c:redirect url="main.jsp" />
  </c:if>

  <forum:postMessage code="${param.id}" message="${param.msg}"
  from="${user.id}" subject="${param.subject}"/>
  
  <c:url value="forum.jsp" var="rtn">
    <c:param name="id" value="${param.id}" />
  </c:url>

  <c:redirect url="${rtn}" />
</c:if>

<html>
  <head>
    <title>
    <fmt:message key="post.title" bundle="${lang}"/></title>
  </head>

  <body>
    <forum:loadForum var="row" code="${param.id}"/>

    <form method="post">
    <h3><fmt:message key="post.ins" bundle="${lang}"/> 
    <c:out value="${row.name}(${row.code})" />

    <input type="hidden" name="id" value="<c:out value="${param.id}"/>"/></h3>

    <fmt:message key="forum.subject" bundle="${lang}"/>
    <input type="text" name="subject" width="60" size="20" />

    <br />

    <textarea rows="10" cols="40" name="msg">
    </textarea>

    <br />

    <input type="submit" name="send" value="<fmt:message key="button.ok" bundle="${lang}"/>" />

    <input type="submit" name="cancel" value="<fmt:message key="button.cancel" bundle="${lang}"/>" />
    </form>

  </body>
</html>

